<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>企业资料 - 测盟汇系统</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <style>
        :root {
            --primary-color: #2c5545;
            --primary-light: #3a7d62;
            --primary-hover: #1e4636;
            --accent-color: #8ba888;
            --error-color: #d64541;
            --success-color: #3a7d62;
            --text-color: #333;
            --text-light: #555;
            --border-color: #d1d9d6;
            --bg-light: #f5f7f6;
            --bg-page: #e8ecea;
            --white: #fff;
            --shadow: 0 4px 24px rgba(44, 85, 69, 0.1);
            --radius: 12px;
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            color: var(--text-color);
            line-height: 1.6;
            background-color: var(--bg-page);
            display: flex;
            min-height: 100vh;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 250px;
            background: var(--primary-color);
            color: var(--white);
            padding: 1.5rem 0;
            height: 100vh;
            position: fixed;
            transition: var(--transition);
            z-index: 100;
        }

        .sidebar-header {
            padding: 0 1.5rem 1.5rem;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .sidebar-header h3 {
            display: flex;
            align-items: center;
            font-weight: 600;
        }

        .sidebar-header h3 i {
            margin-right: 0.5rem;
            font-size: 1.2rem;
        }

        .sidebar-menu {
            padding: 1rem 0;
        }

        .menu-title {
            padding: 0.5rem 1.5rem;
            font-size: 0.8rem;
            text-transform: uppercase;
            color: rgba(255, 255, 255, 0.5);
            letter-spacing: 1px;
        }

        .menu-item {
            padding: 0.75rem 1.5rem;
            display: flex;
            align-items: center;
            color: rgba(255, 255, 255, 0.8);
            text-decoration: none;
            transition: var(--transition);
        }

        .menu-item i {
            margin-right: 0.8rem;
            width: 20px;
            text-align: center;
        }

        .menu-item:hover {
            background: rgba(255, 255, 255, 0.1);
            color: var(--white);
        }

        .menu-item.active {
            background: var(--primary-hover);
            color: var(--white);
            border-left: 3px solid var(--accent-color);
        }

        /* 主内容区域 */
        .main-content {
            flex: 1;
            margin-left: 250px;
            padding: 2rem;
            transition: var(--transition);
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .header h1 {
            color: var(--primary-color);
            font-size: 1.8rem;
        }

        .user-profile {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .user-profile img {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 0.8rem;
            object-fit: cover;
        }

        .user-info {
            display: flex;
            flex-direction: column;
        }

        .user-name {
            font-weight: 500;
        }

        .user-role {
            font-size: 0.8rem;
            color: var(--text-light);
        }

        /* 登出按钮样式 */
        .logout-btn {
            margin-left: 1.5rem;
            padding: 0.5rem 1rem;
            background: var(--white);
            color: var(--error-color);
            border: 1px solid var(--error-color);
            border-radius: var(--radius);
            font-size: 0.9rem;
            text-decoration: none;
            transition: var(--transition);
            display: flex;
            align-items: center;
        }

        .logout-btn:hover {
            background: var(--error-color);
            color: var(--white);
        }

        .logout-btn i {
            margin-right: 0.3rem;
        }

        /* 资料卡片样式 */
        .profile-card {
            background: var(--white);
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            padding: 2rem;
            margin-bottom: 2rem;
        }

        .profile-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border-color);
        }

        .profile-title {
            color: var(--primary-color);
            font-size: 1.5rem;
        }

        .profile-form {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 1.5rem;
        }

        .form-group {
            margin-bottom: 1.2rem;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            color: var(--primary-color);
            font-weight: 500;
        }

        .form-group input,
        .form-group select {
            width: 100%;
            padding: 0.8rem;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            background: var(--bg-light);
        }

        .form-group input:focus,
        .form-group select:focus {
            border-color: var(--primary-color);
            outline: none;
            box-shadow: 0 0 0 2px rgba(44, 85, 69, 0.2);
            background: var(--white);
        }

        .form-actions {
            grid-column: span 2;
            display: flex;
            justify-content: flex-end;
            gap: 1rem;
            margin-top: 1rem;
        }

        .btn {
            padding: 0.8rem 1.5rem;
            border-radius: 6px;
            cursor: pointer;
            transition: var(--transition);
            font-weight: 500;
        }

        .btn-primary {
            background: var(--primary-color);
            color: var(--white);
            border: none;
        }

        .btn-primary:hover {
            background: var(--primary-hover);
        }

        .btn-secondary {
            background: var(--white);
            color: var(--primary-color);
            border: 1px solid var(--primary-color);
        }

        .btn-secondary:hover {
            background: var(--bg-light);
        }

        .error-message {
            color: var(--error-color);
            font-size: 0.9rem;
            margin-top: 0.5rem;
        }

        .success-message {
            color: var(--success-color);
            font-size: 0.9rem;
            margin-top: 0.5rem;
        }

        /* 响应式设计 */
        @media (max-width: 992px) {
            .sidebar {
                width: 70px;
                overflow: hidden;
            }

            .sidebar-header h3 span,
            .menu-title,
            .menu-item span {
                display: none;
            }

            .menu-item {
                justify-content: center;
                padding: 0.75rem 0;
            }

            .menu-item i {
                margin-right: 0;
                font-size: 1.2rem;
            }

            .main-content {
                margin-left: 70px;
            }
        }

        @media (max-width: 768px) {
            .profile-form {
                grid-template-columns: 1fr;
            }

            .form-actions {
                grid-column: span 1;
            }

            .main-content {
                padding: 1.5rem;
            }

            .header {
                flex-direction: column;
                align-items: flex-start;
            }

            .user-profile {
                margin-top: 1rem;
                width: 100%;
                justify-content: space-between;
            }
        }
    </style>
</head>
<body>
<!-- 侧边导航栏 -->
<div class="sidebar">
    <div class="sidebar-header">
        <h3><i class="fas fa-store"></i> <span>测盟汇系统</span></h3>
    </div>

    <div class="sidebar-menu">
        <div class="menu-title">核心功能</div>
        <a href="/index" class="menu-item">
            <i class="fas fa-tachometer-alt"></i>
            <span>控制面板</span>
        </a>

        <div class="menu-title">功能模块</div>
        <a href="#" class="menu-item">
            <i class="fas fa-book-open"></i>
            <span>课程</span>
        </a>
        <a href="/dynamic_list" class="menu-item">
            <i class="fas fa-bullhorn"></i>
            <span>动态</span>
        </a>
        <a href="#" class="menu-item">
            <i class="fas fa-video"></i>
            <span>会议</span>
        </a>

        <div class="menu-title">系统设置</div>
        <a href="/user/profile" class="menu-item">
            <i class="fas fa-user-cog"></i>
            <span>个人资料</span>
        </a>
        <a href="/enterprise/profile" class="menu-item active">
            <i class="fas fa-building"></i>
            <span>企业资料修改</span>
        </a>
    </div>
</div>

<!-- 主内容区域 -->
<div class="main-content">
    <div class="header">
        <h1>企业资料</h1>
        <div class="user-profile">
            <img th:src="@{/images/default-avatar.jpg}" alt="用户头像">
            <div class="user-info">
                <span class="user-name" th:text="${session.user.nickname ?: session.user.username}">用户名</span>
                <span class="user-role" th:text="${session.user.isSuperAdmin ? '超级管理员' : '普通用户'}">用户角色</span>
            </div>
            <a href="/user/logout" class="logout-btn">
                <i class="fas fa-sign-out-alt"></i> 登出
            </a>
        </div>
    </div>

    <!-- 企业资料卡片 -->
    <div class="profile-card">
        <div class="profile-header">
            <h2 class="profile-title">企业基本信息</h2>
        </div>

        <form th:action="@{/enterprise/update-profile}" method="post" th:object="${enterprise}" class="profile-form">
            <div class="form-group">
                <label for="enterpriseName">企业名称</label>
                <input type="text" id="enterpriseName" th:field="*{enterpriseName}" required>
            </div>

            <div class="form-group">
                <label for="contactInfo">联系方式</label>
                <input type="text" id="contactInfo" th:field="*{contactInfo}" required>
            </div>

            <div class="form-group">
                <label for="account">企业账号</label>
                <input type="text" id="account" th:field="*{account}" readonly>
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" th:field="*{password}" required>
            </div>

            <div class="form-group">
                <label for="createTime">创建时间</label>
                <input type="text" id="createTime" th:value="${#dates.format(enterprise.createTime, 'yyyy-MM-dd HH:mm')}" readonly>
            </div>

            <div class="form-group">
                <label for="status">状态</label>
                <select id="status" th:field="*{status}" disabled>
                    <option value="1" th:selected="${enterprise.status == 1}">已激活</option>
                    <option value="0" th:selected="${enterprise.status == 0}">已禁用</option>
                </select>
            </div>

            <div class="form-actions">
                <button type="button" class="btn btn-secondary" onclick="window.location.href='/index'">取消</button>
                <button type="submit" class="btn btn-primary">保存更改</button>
            </div>

            <div th:if="${success}" class="success-message">
                <i class="fas fa-check-circle"></i> 企业资料更新成功
            </div>

            <div th:if="${error}" class="error-message">
                <i class="fas fa-exclamation-circle"></i> <span th:text="${error}"></span>
            </div>
        </form>
    </div>
</div>

<script>
    // 设置当前激活菜单项
    document.addEventListener('DOMContentLoaded', function() {
        const menuItems = document.querySelectorAll('.menu-item');
        const currentPath = window.location.pathname;

        menuItems.forEach(item => {
            if (item.getAttribute('href') === currentPath) {
                item.classList.add('active');
            } else {
                item.classList.remove('active');
            }
        });
    });
</script>
</body>
</html>